<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlertVoteVandidates extends Migration
{
	const TABLE = 'vote_candidates';

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		//
		if (!Schema::hasColumn(self::TABLE, 'resource_id')) {
			Schema::table(self::TABLE, function (Blueprint $table) {
				$table->addColumn('string', 'resource_id', ['length' => 255])->nullable();
			});
		}
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
		if (Schema::hasColumn(self::TABLE, 'resource_id')) {
			Schema::table(self::TABLE, function (Blueprint $table) {
				$table->dropColumn('resource_id');
			});
		}
	}
}
